#!/bin/sh

set -e
set -u

# Import the TBB_INSTALL variable
. /usr/local/lib/tails-shell-library/tor-browser.sh

ua="$(unzip -q -p "${TBB_INSTALL}"/browser/omni.ja \
          defaults/preferences/000-tor-browser.js | \
          sed -n 's@^pref("general\.useragent\.override", "\(.*\)");$@\1@p')"

if [ -z "${ua:-}" ]; then
    echo "Got empty user agent string" >&2
    exit 1
fi

echo "${ua}"
